<include file="Public/head"/>
</head>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="clcwht.clcwxxgl"/>

    <div class="mianR">
        <h3 class="yonghu">添加消息</h3>
        <form id="annForm">
            <div class="gonggao">
                <ul>
                    <li class="clearfix"><span>标题：</span><input type="text" name="title" id="title"
                                                                placeholder="请填写标题"/></li>
                    <li class="clearfix"><span>收信人：</span><input type="text" name="receive_ids" id="receive_ids"
                                                                 placeholder="请输入收信人的用户ID，若不填，则为发送给所有人（用户ID间用英文半角逗号隔开，选填）"/></li>
                    <li class="clearfix"><span>消息参数：</span><input type="text" name="params" id="params"
                                                                  placeholder="请填写消息参数（选填）"/></li>
                    <li class="clearfix"><span>消息内容:</span><span style="width:400px; text-align: left">注意事项:仅支持左对齐；支持空行、换行。</span>
                    </li>
                    <li class="clearfix">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <textarea width="20px" height="30px" name="content" id="content" placeholder="请填写内容"></textarea>
                    </li>
                </ul>
            </div>

            <div class="yongBtn">
                <input type="button" value="确定" class="queding"/>
                <input name="reset" onclick="history.go(-1);" type="reset" class="quxiao" value="取消"/>
            </div>
            <div class="clear"></div>
        </form>
    </div>
    <script type="text/javascript">
        /* UE.getEditor('myEditor',{
         //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
         toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold','test','forecolor','fontsize','editor']],
         //focus时自动清空初始化时的内容
         autoClearinitialContent:true,
         //关闭字数统计
         wordCount:false,
         //关闭elementPath
         elementPathEnabled:false,
         //默认的编辑区域高度
         initialFrameHeight:300
         //更多其他参数，请参考ueditor.config.js中的配置项
         })*/
        $('.quxiao').click(function () {
            window.location.href = "/ClcwMessage/index";
        })
        $('.queding').click(function () {
            var title = $("#title").val();
            var receive_ids = $.trim($("#receive_ids").val());
            if (receive_ids != '') {
                var reg = /^(\d+,?)+$/;
                if (!reg.test(receive_ids)) {
                    shibai_alert("抱歉，收信人填写不正确");
                    return false;
                }
            }
            var params = $("#params").val();
            var content = $("#content").val();
            $.post('/ClcwMessage/addMessageData', {
                'title': title,
                'receive_ids': receive_ids,
                'params': params,
                'content': content
            }, function (data) {
                if (data.code != 200) {
                    shibai_alert(data.msg, 800);
                    return false;
                }
                btn_alert(data.msg, 1000, function () {
                    window.location.href = "/ClcwMessage/index";
                });
            }, 'json');
        });
    </script>
    </body>
    </html>
